package RiverCrossingMinigame;

import java.util.ArrayList;

import javax.swing.JOptionPane;

// Some code was adapted from the Virginia CS homework assignments and 
// tutorials/examples/explanations found here http://www.cs.virginia.edu/cs201j/problem-sets/ps5/

/**
 * This class represents the player vehicle in the river crossing minigame 
 * 
 * @author Ray DeCuir
 * @version 1.0
 *
 */
public class Vehicle extends Movable
{
	
	/**
	 * Checks to see if a player has won, if so launch the player has won screen 
	 * 
	 * @return A boolean denoting if the player has won yet or not
	 */
	public boolean win() {
		if (getY()==0){
			JOptionPane.showMessageDialog(null, "You WIN!");
		}
		GameDriver.won = 1;
		
		return getY() == 0;
	}
	
	/**
	 * Checks to see if a player has lost, if so launch the player has lost screen 
	 * 
	 */
	public void lose() {
		JOptionPane.showMessageDialog(null, "You lose!");
		/*
		ArrayList<Integer> items = new ArrayList<Integer>();
		for ( int i = 0 ; i < playerCaravan.getInventory().getNumberOfItems() / 10 ; i++ ){
		
			int id = playerCaravan.getInventory().getRandomInventoryItemId();
			playerCaravan.getInventory().addItem( id, -1 ); 
			items.add(id);
		}
		String itemsLost = "";
		if ( items.size() == 0 ){
			itemsLost = "You tipped, but fortunately didn't lose anything!"
		}
		else{
			itemsLost = "You tipped over! You lost a ";
			for ( int id : items ) {
				itemsLost += itemlist.getItemName(id) + ", ";
			}
			itemsLost = itemsLost.substr(0, itemsLost.length - 3);
		}
		JOptionPane.showMessageDialog(null, itemsLost);
		  
		  
		 */
	}
	
	/**
	 * Blank method for the player turn implementation required in the Movable class, 
	 * player movement is controlled in the Game panel class
	 * 
	 */
	public void executeTurn(){
		
	}
}